package com.kedi.welfarecenter.service.operationcenter.impl;

import com.kedi.welfarecenter.read.dao.mapper.MedicalPenFuseMapper;
import com.kedi.welfarecenter.service.operationcenter.MedicalPenFuseService;
import com.kedi.welfarecenter.write.dao.mapper.WriteMedicalPenFuseMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
* @Description:    医养融合
* @Author:         ytw
* @CreateDate:     2019/7/23 16:05
* @UpdateRemark:   修改内容
* @Version:        1.0
*/
@Service
public class MedicalPenFuseServiceImpl implements MedicalPenFuseService {
    @Autowired
   private  MedicalPenFuseMapper mapper;

    @Autowired
    private WriteMedicalPenFuseMapper medicalPenFuseMapperMapper;

    @Override
    public List<Map<String, Object>> selectoldlifeservice() {
        return mapper.selectoldlifeservice();
    }

    @Override
    public Integer findbyoldlifename(String name) {
        return mapper.findbyoldlifename(name);
    }

    /**
    * 方法实现说明  机构已存在的情况
    * @author      ytw
    *@param
    * @return
    * @exception
    * @date        2019/7/24 18:37
    */
    @Transactional(rollbackFor=Exception.class)
    @Override
    public Integer createMedicalPenFuse(Map map) {
        return     medicalPenFuseMapperMapper.createoldlifeservice(map);

    }
/**
* 方法实现说明  机构不存在 需要先插入 机构 返回主键 插入详情表
* @author      ytw
*@param
* @return
* @exception
* @date        2019/7/24 18:37
*/
    @Transactional(rollbackFor=Exception.class)
    @Override
    public Integer createMedicalPenFuseAndOldlife(Map map) {
        medicalPenFuseMapperMapper.createoldlifename(map);
       return medicalPenFuseMapperMapper.createoldlifeservice(map);
    }


}
